package com.blog.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.blog.bean.Complaint;
import com.blog.bean.User;
import com.blog.dao.IComplaintDao;
import com.blog.dao.IUserDao;

/**
 * @className: ComplaintController
 * @description: 
 * @author: HCl
 * @createTime: 2020年6月10日 下午5:25:13
 */
@Controller
public class ComplaintController {
	@Autowired
	private IUserDao userDao;
	@Autowired
	private IComplaintDao complaintDao;
	
	@RequestMapping(value = "addComplaint")
	@ResponseBody
	public Map<String, Object> addComplaint(int blogid,String reason,HttpSession session){
		Complaint complaint = new Complaint();
		User user = (User) session.getAttribute("loginUser");
		if (user == null) {
			complaint.setObjectid(blogid);
			complaint.setPublisher(0);
			complaint.setObjecttype(1);
			complaint.setReason(reason);
			complaint.setState(1);
			int i = complaintDao.addComplaint(complaint);
		} else {

		}
		
		
		return new HashMap<String, Object>();
		
		
	}

}
